package com.example.demo.controller;

import com.example.demo.pojo.XueSheng;
import com.example.demo.service.impl.XueShengServiceImpl;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 学生表(XueSheng)表控制层
 *
 * @author 小虾米大侠
 * @since 2021-03-19 09:35:27
 * @version 1.0
 */
@RestController
@RequestMapping("xueSheng")
@Api(value = "学生表(XueSheng)管理",tags = "学生表(XueSheng)管理接口API")
@ApiResponses({
        @ApiResponse(code=400,message="请求参数不完整或者错误"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=405,message="请求方式不正确，比如后台接收是post，但前端请求的是get"),
        @ApiResponse(code=406,message="页面地址和接口名冲突"),
        @ApiResponse(code=415,message="请求格式不正确，前端可能没有把请求头修改为json，也可能前端请求的json对象没有转换为字符串"),
        @ApiResponse(code=500,message="后台服务逻辑错误")
})
public class XueShengController {
    /**
     * 服务对象
     */
    @Resource
    private XueShengServiceImpl xueShengServiceImpl;


        @RequestMapping(value = "login", method = RequestMethod.POST)
    @ApiOperation(value = "登陆接口接口",notes = "登陆接口",httpMethod = "POST")
    public Map<String, Object> login(@RequestBody @ApiParam(name = "xueSheng",value = "pojo模型",required = true) XueSheng xueSheng) {
        return this.xueShengServiceImpl.login(xueSheng);
    }







    /**
     * 通过主键查询单条数据
     * @param page  需要查询的页码
     * @param xingMing  模糊查询的内容
     * @return 单条数据
     */
    @RequestMapping(value = "chaXunFenYe", method = RequestMethod.GET)
    @ApiOperation(value = "列表查询分页接口",notes = "列表查询分页接口",httpMethod = "GET")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",value = "页码",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "xingMing",value = "姓名",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "xueHao",value = "学号",paramType = "query",dataType = "String",required = false),
    })
    public Map<String, Object> chaXunFenYe(@RequestParam(name = "page") int page, String xingMing, String xueHao) {
        return this.xueShengServiceImpl.chaXunFenYe(page, xingMing,xueHao);
    }


    /**
     * 通过主键更新单条数据
     *
     * @param xueSheng 一个数据库对应的POJO数据对象
     * @return 单条数据
     */
    @RequestMapping(value = "gengXinById", method = RequestMethod.POST)
    @ApiOperation(value = "更新权限的接口",notes = "通过主键更新一个**的接口",httpMethod = "POST")
    public Map<String, Object> gengXinById(@RequestBody @ApiParam(name = "xueSheng",value = "pojo模型",required = true) XueSheng xueSheng) {
        return this.xueShengServiceImpl.gengXinById(xueSheng);
    }

    /**
     * 通过主键更新单条数据
     *
     * @param xueSheng 一个数据库对应的POJO数据对象
     * @return 单条数据
     */
    @RequestMapping(value = "xiuGai", method = RequestMethod.POST)
    @ApiOperation(value = "更新权限的接口",notes = "通过主键更新一个**的接口",httpMethod = "POST")
    public Map<String, Object> xiuGai(@RequestBody @ApiParam(name = "xueSheng",value = "pojo模型",required = true) XueSheng xueSheng) {
        return this.xueShengServiceImpl.xiuGai(xueSheng);
    }




}